class Solution(object):
    def containsPattern(self, arr, m, k):
        n = len(arr)
        for i in range(n - m * k + 1):
            num = 1
            for j in range(1, k):
                if arr[i + j * m: i + (j + 1) * m] == arr[i: i + m]:
                    num += 1
                else:
                    break
            if num == k:
                return True
        return False


data = Solution()
arr = [1, 2, 4, 4, 4, 4]
m = 1
k = 3
print(data.containsPattern(arr, m, k))
arr = [1, 2, 1, 2, 1, 1, 1, 3]
m = 2
k = 2
print(data.containsPattern(arr, m, k))
